#pragma once
#include "DataDef.h"
#include "DeviceHolder.h"

#include <vector>
#include <sstream>
#include <string>

#define WRITE_AND_CLEAR_TXT(ss, wstr) ss>>wstr; Util::writeLine(wstr); ss.clear(); wstr.clear();
#define DRAW_SURFACE(texMgr, alias, util) (util->drawSurface(*texMgr->getSurface(alias)));

using namespace std;

class Util :
	public DeviceHolder
{
public:
	Util(const LPDIRECT3DDEVICE9 device);

	~Util(void);

	LPD3DXMESH generateQuad();

	void renderText() const;

	FLOAT time();

	void drawSurface(IDirect3DSurface9 *surface, const LONG xOff = 0.0f, const LONG yOff = 0.0f) const;

	static void writeLine(wstring line);
private:

	void setupFonts();
	LPD3DXFONT g_font;
	static vector<wstring> lineQueue;

	static const UINT fontWidth = SCREEN_WIDTH / 100;
	static const UINT fontHeight = SCREEN_HEIGHT / 40;
};
